package com.sc.nft.admin.controller;

import com.sc.nft.admin.request.EcologyPoolSourceRequest;
import com.sc.nft.admin.request.IdRequest;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.entity.dto.AdminEcologyPointsDTO;
import com.sc.nft.entity.dto.AdminEcologyPointsPageDTO;
import com.sc.nft.entity.dto.EcologyHatchExtraRewardsDTO;
import com.sc.nft.entity.dto.EcologyHatchExtraRewardsSaveDTO;
import com.sc.nft.entity.vo.EcologyHatchExtraRewardsAdminVO;
import com.sc.nft.entity.vo.ecology.AdminEcologyPointsDetailsVO;
import com.sc.nft.entity.vo.ecology.AdminEcologyPointsPageVO;
import com.sc.nft.entity.vo.ecologypool.EcologyPoolSourceVO;
import com.sc.nft.service.EcologyPointsService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author Radish
 * @Description:
 * @date 2024-12-02
 */@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/crystal")
@Api(tags = "生态积分配置")
public class CrystalController {



     private final EcologyPointsService ecologyPointsService;


    @PostMapping(value = "/edit", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "新增或者修改积分", notes = "新增或者修改积分", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result editCrystal(@Valid @RequestBody AdminEcologyPointsDTO dto) {
        ecologyPointsService.editCrystal(dto);
        return Result.success();
    }


    @PostMapping(value = "/detail", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "积分详情", notes = "积分详情", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result<AdminEcologyPointsDetailsVO> getAdminEcologyHatchExchangeConf(@Valid @RequestBody IdRequest request) {
        return Result.success(ecologyPointsService.adminEcologyPointsDetails(request.getId()));
    }

    @ApiOperation(value = "积分列表 根据daoId", notes = "积分列表 根据daoId", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/pointsPage", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<AdminEcologyPointsPageVO> sourcePage(@RequestBody @Valid AdminEcologyPointsPageDTO dto) {
        return PageResult.success(ecologyPointsService.adminEcologyPointsPage(dto.getDaoId(),dto.getPageNo(),dto.getPageSize()));
    }


}
